package com.army.study.widget.widget2x4;

import com.army.study.slice.MainAbilitySlice;
import com.army.study.widget.controller.FormController;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.ability.ProviderFormInfo;
import ohos.aafwk.content.Intent;
import ohos.app.Context;
import ohos.hiviewdfx.HiLog;
import ohos.hiviewdfx.HiLogLabel;
import ohos.utils.zson.ZSONObject;

/**
 * Form controller implementation.
 */
public class Widget2x4Impl extends FormController {
    private static final HiLogLabel TAG = new HiLogLabel(HiLog.DEBUG, 0x0, Widget2x4Impl.class.getName());

    public Widget2x4Impl(Context context, String formName, Integer dimension) {
        super(context, formName, dimension);
    }

    @Override
    public ProviderFormInfo bindFormData(long formId) {
        return null;
    }

    @Override
    public void updateFormData(long formId, Object... vars) {
    }

    @Override
    public void onTriggerFormEvent(long formId, String message) {
        HiLog.info(TAG, "onTriggerFormEvent()" + ", formId: " + formId + ", message: " + message);
    }

    @Override
    public Class<? extends AbilitySlice> getRoutePageSlice(Intent intent) {
        HiLog.info(TAG, "set route page slice.");
        return MainAbilitySlice.class;
//        String param = intent.getStringParam("params");
//        ZSONObject zsonObject = ZSONObject.stringToZSON(param);
//        switch (zsonObject.getString("message")) {
//            case "New":
//                return MainAbilitySlice.class;
//            case "History":
//                return FunctionHistorySlice.class;
//            default:
//                return null;
//        }
    }


}
